var zd_option={};
var main = new Vue({
	el: '#main',
	data: {
		left: ["全部", "全部", "全部"],
		middle: ["未评估", "未完成", "未领取"],
		right: ["已评估", "已完成", " 已领取"],
		response: [],
		pingguzhong:'0',
		pinggujin:'0',
	},
	methods: {
		openwindow: function(n) {
			if(Object.getOwnPropertyNames(zd_option).length<6){
				return false;
			}
			sessionStorage.zd_option=JSON.stringify(zd_option);
			if(n == 0) {
				window.location.href = 'page/pinggu/list.html';
			} else if(n == 1) {
				window.location.href = 'page/yihu/list.html'
			} else if(n == 2) {
				window.location.href = 'page/yiyao/list.html'
			} else if(n == 3) {
				window.location.href = 'page/fuwu/list.html'
			} else if(n == 4) {
				window.location.href = 'page/fuwu/chaxun.html'
			}
		}
	}
})
//localStorage.clear(); //清除缓存
//ios
/*
function alertMessage(message) {
	console.log("获取的身份ID"+message)
	localStorage.shenfenid=message;
	ajaxhomeid(message)
}
function FromJavaLoginInfo() {
	//调用android程序中的方法，并传递参数
	var result = window.AndroidWebView.getLoginInfo();
	localStorage.shenfenid=result;
	console.log("获取的身份ID"+result)
	ajaxhomeid(result);
}
if(iosipone){}else{
	FromJavaLoginInfo()
}*/
function tamen() {
	$.ajax({
		type: 'POST',
		url: 'http://221.0.79.248:8082/api/ysd/getUserInfo.service',
		headers: {
			"AUTH_KEY_JKCS_YSD": JSON.parse(localStorage.token).AUTH_KEY_JKCS_YSD,
			"AUTH_KEY_JKCS_YSDtimestamp": JSON.parse(localStorage.token).AUTH_KEY_JKCS_YSDtimestamp,
		},
		data: "",
		success: function(result) {
			if(result.code == 'ERROR-AUTH-UNLOGIN_AUTH_KEY_JKCS_YSD') {
				//询问框
				layer.open({
					content: '登陆信息超时，请重新登陆？',
					btn: ['退出'],
					yes: function(index) {
						window.AndroidWebView.sendBroad();	
						layer.close(index);
					}
				});
			}else{
				ajaxhomeid(result.data.sfzh)
			}

		}
	})
}
//tamen();
localStorage.token=JSON.stringify({
	AUTH_KEY_JKCS_YSD:'7627862b27fb273bbf2bf',
	AUTH_KEY_JKCS_YSDtimestamp:'167676364'
})
//ajaxhomeid('370481198411125626');
ajaxhomeid('320500199010249751');
function ajaxhomeid(idCard) {
	ajaxPost(
		Url.PGAPPLY_CHECK, {
			zjhm: idCard,
			type: 'doctor'
		},
		function(data) {
			if(data.status == "1") {
				localStorage.user_info = JSON.stringify(data.response)
				ajax_home()
			}
		}
	)
}

function ajax_home() {
	ajaxGet(
		Url.ASSESS_SERVICES, {},
		function(data) {
			if(data.status == 1) {
				main.response = data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_EVSVATE, {
			doctorName:JSON.parse(localStorage.user_info).name
		},
		function(data) {
			if(data.status == 1) {
				main.pinggujin = data.response.todayCount;
				main.pingguzhong = data.response.totalCount;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"MZ",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.minzhu=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"GJ",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.guoji=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"GJ",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.guoji=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"HYZK",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.hyzk=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"ABOXX",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.aboxx=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"RHXX",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.rhxx=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"WHCD",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.wenhuacd=data.response;
			}
		}
	)
	ajaxPost(
		Url.ASSESS_GETDIC, {
			type:"JTGX",
			name:''
		},
		function(data) {
			if(data.status == 1) {
				zd_option.lianxirgx=data.response;
				console.log(zd_option)
				console.log(Object.getOwnPropertyNames(zd_option).length)
			}
		}
	)
}
if(iosipone) {
	document.getElementById("iosbox").setAttribute("style", "display: block;")
};
document.getElementById("main").setAttribute("style", "display: block;");